package com.khalil.kkadmin.system.dms.store;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DocumentStoreFactory {

    @Autowired
    private List<DocumentStore> documentStores;

    public DocumentStore getDocumentStore(StoreType type) {
        for (DocumentStore documentStore : documentStores) {
            boolean support = documentStore.support(type);
            if (support) {
                return documentStore;
            }
        }
        return null;
    }
}
